<script language="javascript">
    $(document).ready(function(){
        $("#checkall").click(function(){
            var checked_status = this.checked;
            $('input[type="checkbox"]').each(function(){
               this.checked = checked_status;
            });
        });
    });
</script>

<script language="javascript">
    $(document).ready(function(){
        $("#checkall").click(function(){
            var checked_status = this.checked;
            $('input[type="checkbox"]').each(function(){
               this.checked = checked_status;
            });
        });
    });
</script>
<?php //echo $javascript->link('jquery-1.4.2.js');?>
<?php echo $this->Form->create('NhanVien',array('action'=>'admin_process')); ?>
<div class="head_title"> <h1 align="center">QUẢN LÝ NHÂN VIÊN</h1></div>
<p>

</p>
<table>
    <tr>
		<th><?php echo $this->Form->checkbox('all',array('id'=>'checkall')); ?></th>
        <th>ID</th>
        <th>MÃ CHỨC VỤ</th>
        <th>TÊN NHÂN VIÊN</th>
        <th>ĐỊA CHỈ</th>
        <th>NĂM SINH</th>
        <th>GIỚI TÍNH</th>
		<th>SỐ ĐIỆN THOẠI</th>
		<th>EMAIL</th>
        <th>THAO TÁC</th>
    </tr>

<!-- Here's where we loop through our $posts array, printing out post info -->

    <?php foreach ($nhanviens as $nhanvien): ?>

    <tr>
		<td><?php echo $this->Form->checkbox('NhanVien.id.'.$nhanvien['NhanVien']['id']); ?></td>
        <td>
            <?php echo $nhanvien['NhanVien']['id'];?>
        </td>
        <td>
            <?php echo $nhanvien['NhanVien']['MACV'];?>
        </td>
        <td>
            <?php echo $nhanvien['NhanVien']['TENNV'];?>
        </td>
        <td>
            <?php echo $nhanvien['NhanVien']['DIACHINV']?>
        </td>
        <td>
            <?php echo date('d-m-Y', strtotime($nhanvien['NhanVien']['NAMSINH']))?>
        </td>
        <td>
            <?php echo $nhanvien['NhanVien']['GIOITINH']?>
        </td>
		<td>
            <?php echo $nhanvien['NhanVien']['SDT']?>
        </td>
		<td>
            <?php echo $nhanvien['NhanVien']['email']?>
        </td>
        <td>

            <?php  echo $this->Html->link($this->Html->image('/images/user_edit.png'), array('action' => 'edit', $nhanvien['NhanVien']['id']), array('escape' => false));?>
			<?php
            echo $this->Html->link($this->Html->image('/images/trash.png'), array('action' => 'delete', $nhanvien['NhanVien']['id']),
                array('confirm' => 'Bạn có chắc muốn xóa?', 'escape' => false));
            ?>
        </td>
    </tr>
    <?php endforeach; ?>

</table>
<?php
     echo $this->Form->end('Xóa các mục đã chọn', array('action' => 'Delete'));
?>
<div id="pagination">
    <div class="paging">
        <?php echo $this->Paginator->first('Trang đầu'); ?>
        <?php echo $this->Paginator->prev('<<' . __('Lùi', true),
        array(), null, array('class' => 'disabled')); ?>
        <?php echo $this->Paginator->numbers(); ?>
        <?php echo $this->Paginator->next(__('Tới', true) . '>>',
        array(), null, array('class' => 'disabled')); ?>
        <?php echo $this->Paginator->last('Trang cuối'); ?>
    </div>
</div>

<?php echo $this->Html->link('Thêm nhân viên', array('action' => 'add'), array('class' => 'add'));?>